package com.example.demo.dto;

import com.example.demo.entity.User;

import java.io.Serializable;
import java.util.Objects;

public class UserDTO implements Serializable{
    private static  final long serialVersionUID = 1L;

    private int uid;
    private String username;  //对应的是数据库的uname字段
    private String upassword; //密码
    private String img;//图片
    private String usex; //性别
    private Integer uage;
    private String urole; //用户 0 管理员 1

    public UserDTO(int uid, String username, String upassword, String img, String usex, Integer uage, String urole) {
        this.uid = uid;
        this.username = username;
        this.upassword = upassword;
        this.img = img;
        this.usex = usex;
        this.uage = uage;
        this.urole = urole;
    }

    public UserDTO() {
    }

    public static long getSerialVersionUID() {
        return serialVersionUID;
    }

    public int getUid() {
        return uid;
    }

    public void setUid(int uid) {
        this.uid = uid;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getUpassword() {
        return upassword;
    }

    public void setUpassword(String upassword) {
        this.upassword = upassword;
    }

    public String getImg() {
        return img;
    }

    public void setImg(String img) {
        this.img = img;
    }

    public String getUsex() {
        return usex;
    }

    public void setUsex(String usex) {
        this.usex = usex;
    }

    public Integer getUage() {
        return uage;
    }

    public void setUage(Integer uage) {
        this.uage = uage;
    }

    public String getUrole() {
        return urole;
    }

    public void setUrole(String urole) {
        this.urole = urole;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        UserDTO userDTO = (UserDTO) o;
        return uid == userDTO.uid && Objects.equals(username, userDTO.username) && Objects.equals(upassword, userDTO.upassword) && Objects.equals(img, userDTO.img) && Objects.equals(usex, userDTO.usex) && Objects.equals(uage, userDTO.uage) && Objects.equals(urole, userDTO.urole);
    }

    @Override
    public int hashCode() {
        return Objects.hash(uid, username, upassword, img, usex, uage, urole);
    }

    @Override
    public String toString() {
        return "UserDTO{" +
                "uid=" + uid +
                ", username='" + username + '\'' +
                ", upassword='" + upassword + '\'' +
                ", img='" + img + '\'' +
                ", usex='" + usex + '\'' +
                ", uage='" + uage + '\'' +
                ", urole='" + urole + '\'' +
                '}';
    }

}
